Detect the number of local variables declared in a functionΒΆ
Detect the number of local variables declared in a function.
def abc():
x = 1
y = 2
S = "w3resource"
print("Python Exercises")
# test
print(abc.__code__.co_nlocals) # 3